#include<iostream>
#include<cstdio>
#include<queue>
#include<cstdlib>
#include<cstring>
using namespace std;
int n;
long long bl,br;
int a[13];
int mn=1e9;
int cnt;
long long d[500010];
bool inq[500010];
long long calc(long long x)
{
    long long res=0;
    for(int i=0;i<mn;i++)
    {
        if(d[i]>x)continue;
        res+=(x-d[i])/mn+1;
    }
    return res;
}
int main()
{
    scanf("%d%lld%lld",&n,&bl,&br);
    for(int i=1;i<=n;i++)
    {
        int x;
        scanf("%d",&x);
        if(!x)continue;
        a[++cnt]=x;
        mn=min(mn,a[i]);
    }
    for(int i=1;i<mn;i++)d[i]=1e18;
    queue<int>q;
    q.push(0);
    inq[0]=true;
    while(!q.empty())
    {
        int x=q.front();
        q.pop();
        inq[x]=false;
        for(int i=1;i<=cnt;i++)
        {
            int y=(x+a[i])%mn;
            if(d[x]+a[i]<d[y])
            {
                d[y]=d[x]+a[i];
                if(!inq[y])
                {
                    inq[y]=true;
                    q.push(y);
                }
            }
        }
    }
    printf("%lld",calc(br)-calc(bl-1));
    return 0;
}
